package esya;
import java.sql.*;

public class createDb {
	public static void main(String args[]) throws ClassNotFoundException, SQLException{
		
		Class.forName("com.mysql.jdbc.Driver");
		String url = "jdbc:mysql://localhost/mysql?" + "user=root&password=";; 
	    Connection conn = DriverManager.getConnection(url);
	    
	    //System.out.println("connected");
	    
	    Statement stmt = null;
        //ResultSet rs = null;
        
        String tableName="EVENTS";
        String createString;
        createString = "DROP TABLE IF EXISTS "+tableName;
        stmt = conn.createStatement();
        stmt.executeUpdate(createString);
        stmt.close();


        createString = "CREATE TABLE "+tableName+"(event_name varchar(50) NOT NULL, keywords varchar(100)," +
         "date varchar(10) NOT NULL,time varchar(15) NOT NULL,venue varchar(20), Prizes varchar(5), PRIMARY KEY(event_name))";
        
        stmt = conn.createStatement();
        stmt.executeUpdate(createString);
        stmt.close();
        conn.close();
        
        System.out.println("table created");
        
        InsertVal iv= new InsertVal();
        iv.insert();
        
       // Query q=new Query();
       // q.query();
        
       ProcessInp p=new ProcessInp();
       p.query("esya Pwned");
	}
}
